#include "Control.h"
#include <eggx.h>
#include <eggx_color.h>

Control::Control() {
    //this->model = Surface();
    //this->view = Image();
    this->number_of_steps = 100;
    this->current_step = 0;
}

Control::~Control() {
 //   gclose(this->view.get_win());
}



void Control::draw(const int& type){
    //this->view.draw(this->model, DS9_GREEN);
    msleep(100);
    this->view.draw(this->model, type);
}

void Control::make_step() {
    this->model.rain();
    draw(DS9_BLUE);
    this->current_step++;
}

Control::Control(const int &num_of_steps, const int &max_height, const int &min_height, const int &rain_modifier) {
    this->number_of_steps = num_of_steps;
    this->current_step = 0;
    this->model = Surface(max_height, min_height, rain_modifier);
}

void Control::set_number_of_steps(const int &value) {
    this->number_of_steps = value;
}

void Control::simulate() {
    while (this->current_step != this->number_of_steps) {
        make_step();
    }
}

Surface Control::get_model() const {
    return this->model;
}

int Control::get_number_of_steps() const {
    return this->number_of_steps;
}

int Control::get_current_steps() const {
    return this->current_step;
}


